//
//  LGKNoteBaseNavigationController.m
//  LGKNote
//
//  Created by 刘亚军 on 2023/5/26.
//

#import "LGKNoteBaseNavigationController.h"
#import "LGKConst.h"
@interface LGKNoteBaseNavigationController ()

@end

@implementation LGKNoteBaseNavigationController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.navigationBar.translucent = NO;
    [self updateNavBarInfo];
}
- (void)updateNavBarInfo{
    UIView *bgColorView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, LG_ScreenWidth, [self.view yj_customNavBarHeight])];
    [bgColorView yj_setGradientBackgroundWithColors:@[LG_ColorWithHex(0x0EB3FA),LG_ColorWithHex(0x0076F5)] locations:nil startPoint:CGPointMake(0, 0) endPoint:CGPointMake(1, 0)];
    UIImage *bgImg = [UIImage yj_imageWithView:bgColorView];
    [self.navigationBar setBackgroundImage:bgImg forBarMetrics:UIBarMetricsDefault];
    self.navigationBar.tintColor = [UIColor whiteColor];
    
    NSDictionary *titleAttr = @{NSForegroundColorAttributeName:[UIColor whiteColor],
                                NSFontAttributeName:[UIFont systemFontOfSize:18.0f]};
    self.navigationBar.titleTextAttributes = titleAttr;
    
    if (@available(iOS 13.0, *)) {
        UINavigationBarAppearance *appearance = [UINavigationBarAppearance new];
        appearance.backgroundImage = bgImg;
        appearance.titleTextAttributes = titleAttr;
        self.navigationBar.standardAppearance = appearance;
        self.navigationBar.scrollEdgeAppearance = appearance;
    }
}

@end
